<!--
/**
 * @file CronTools.html
 * @author Alejandro Dario Simi
 * @date $Date: 2012-08-25 04:56:44 +0000 (Sat, 25 Aug 2012) $
 *
 * $Id: CronTools.html 44 2012-08-25 04:56:44Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0-BETA2/docs/CronTools.html $
 */
-->
<html>
	<head>
		<title>Cron Tools</title>
		<link rel="stylesheet" type="text/css" href="docs.css"/>
		<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="docs.js"></script>
	</head>
	<body>
		<div class="Section">
			<span class="Title">Table Of Contents</span>
			<div class="TableOfContents"></div>
		</div>
		<div class="Section">
			<span class="Title">Cron</span>
			<div class="Paragraph">
				<p>One of the most important pieces of wcomix are its cron tools. This tools are a set of PHP scripts that can be run only from a
				terminal or from some other application like "[L:http://en.wikipedia.org/wiki/Cron::cron]" in UNIX-like operative systems, and they
				perform diferent tasks needed to keep the wcomix site consistent.</p>
				<p>wcomix provide a central script called "cron.php" saved along with the other tools into "[VA:$wcROOTDIR]/tools". This central
				script will use a descriptor called [VA:$wcCronScripts] to call all needed tools and execute them in the right order</p>
				<p>This page will present these tools and explain the need for them to run periodically.</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Updating Comic List</span>
			<div class="Paragraph">
				<p>This tool is the script "comics.update.list.php" and basically it performs two tasks:
				<ul>
					<li>seek and load comics,</li>
					<li>mark lost comics.</li>
				</ul>
				</p>
				<p>The seeking and loading comics task consist in look inside every directory configured in every group and insert all comic names
				into the table [CO:comics]. This operation is requiered because every comic search made wcomix site uses this table and not directly
				a directory. This kind of behavior is quicker in performance than reading a directory, but it requires to keeps the list up to date,
				otherwise, new comics won't be shown anywhere in the wcomix site. This is the main reason for a first cron execution at the wcomix
				site installation.</p>
				<p>The second task it performs is to mark every comic listed in table "comics" that is no longer in its position. This operation
				allows the administrator to check and correct this kind of issues.</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Running Rules</span>
			<div class="Paragraph">
				<p>This tools saved in "rules.run.php" executes every tag rule configured in the table "rules". As you may read in section
				"[L:Rules_Actions.html::Rules &amp; Actions]", these rules are related to extensions installed in the wcomix site.</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Updating NOTAG entries</span>
			<div class="Paragraph">
				<p>"tags.update.NOTAG.php"</p>
				<p>@todo</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Updating FEWTAGS entries</span>
			<div class="Paragraph">
				<p>"tags.update.FEWTAGS.php"</p>
				<p>@todo</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Moving Trash Into Trashcan</span>
			<div class="Paragraph">
				<p>"tags.move-trash.php"</p>
				<p>@todo</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Finding Losts</span>
			<div class="Paragraph">
				<p>"tags.find.losts.php"</p>
				<p>@todo</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Update Statistics</span>
			<div class="Paragraph">
				<p>"stats.update.counts.php"</p>
				<p>@todo</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Cron Descriptor</span>
			<div class="Paragraph">
				<p>If it's necesary, a developer can add an arbitrary operation to be run when cron is executed. For this purpose, a
				new entry must be added in the descriptor [VA:$wcCronScripts] following the next structure:</p>
<pre class="Code">
{VA:$wcCronScripts[]} = array(
		{CO:'name'}		=> "TITLE",
		{CO:'path'}		=> "FULL_PATH.php",
		{CO:'params'}	=> array({CO:'PARAM1'}, {CO:'PARAM2'})
	);
</pre>
				Where:<ul>
					<li>[CO:name] is a title to be shown where the tool is run.</li>
					<li>[CO:path] must be full path to a PHP script containing the logic to be executed periodically.</li>
					<li>[CO:params] List of arguments to be provided when the script is run.</li>
				</ul></p>
				<p>For this kind of added functionality, it is recommended to store the extended logic into a new folder inside
				"[VA:$wcROOTDIR]/extensions" and add a single entry in "local.conf.php" to include a main PHP file inside this new
				folder.</p>
			</div>
		</div>
	</body>
</html>